package com.linran.poll.controller;

import com.linran.poll.domain.Result;
import com.linran.poll.domain.ResultUtil;
import com.linran.poll.service.ILongPollingService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("lock")
public class LockLongPollingController {
    @Resource(name = "lockLongPollingServiceImpl")
    private ILongPollingService lockLongPollingService;

    @RequestMapping("pull")
    public Result pull() {
        String result = lockLongPollingService.pull();
        return ResultUtil.success(result);
    }

    @RequestMapping("push")
    public Result push(@RequestParam("data") String data) {
        String result = lockLongPollingService.push(data);
        return ResultUtil.success(result);
    }
}
